package com.jt.proxy;

import com.jt.pojo.User;
import com.jt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("userService")
public class StaticProxy implements UserService {
    @Autowired
    private UserService target;
    @Override
    public void adduser(User user) {
                try {
            System.out.println("开启事务");
            target.adduser(user);
            System.out.println("结束事务");

        }catch (Exception e){
            e.printStackTrace();
            System.out.println("回滚");
        }
    }

    @Override
    public void deleteUser(User user) {

    }
}
